<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<div class="button_area">
	<a class="button submit">保存</a>&nbsp;&nbsp;
	<a href="employee/employee.action" class="button">返回</a>
</div>
<s:form method="post" action="employeeUpdate" namespace="/employee">
	<s:hidden name="employee.employeeId"></s:hidden>
	<tr>
		<td>
			<table class="form_table">
				<s:textfield label="入职日期" name="employee.timeOfEmployment"  id="employee_timeOfEmployment" size="18"
					required="true" maxlength="100"></s:textfield>
				<s:textfield label="转正日期" name="employee.registerTime"  id="employee_registerTime" size="18"
					 maxlength="100"></s:textfield>
				<s:textfield label="员工编号" name="employee.employeeNumber" size="18"
					maxlength="20"></s:textfield>
				<s:textfield label="姓名" name="employee.employeeName" size="18"
					required="true" maxlength="20"></s:textfield>
				<s:textfield label="业务名" name="employee.businessName" size="18"
					maxlength="20"></s:textfield>
				<s:select label="部门" list="departments" id="employee_department" 
					name="employee.department.dictionaryId" onchange="$('#employee_position_positionId').changeSelect(this.value)"
					listKey="dictionaryId" listValue="dictionaryName"
					>
				</s:select>
				<s:select label="职位" id="employee_position_positionId" name="employee.position.dictionaryId"
					list="{}"   ></s:select>
				<!-- TODO -->
				<s:textfield label="级别" name="employee.employeeClass" size="18"
					 maxlength="20"></s:textfield>
		
				<s:textfield label="身份证号" name="employee.socialId"
									id="employee_socialId" size="18" maxlength="20"></s:textfield>
				<s:select label="性别" list="sex" id="sex"
					name="employee.sex.dictionaryId" listKey="dictionaryId"
					required="true" listValue="dictionaryName" >
				</s:select>
				<s:textfield label="民族" name="employee.ethnic" size="18"
					maxlength="20"></s:textfield>
				<s:textfield label="籍贯" name="employee.birthPlace" size="18"
					maxlength="20"></s:textfield>
					<!-- TODO -->
				<s:textfield label="年龄" name="employee.age" size="18" id="age"
					maxlength="20"></s:textfield>
				<s:textfield label="出生日期" name="employee.birthday"  id="employee_birthday" size="18"
					maxlength="20"></s:textfield>
				<s:textfield label="农历生日" name="employee.chineseBirthday" size="18"
					maxlength="20"></s:textfield>
				<s:select label="角色" list="roles" 
					name="employee.userInfo.role.roleId" listKey="roleId"
					listValue="roleName" headerValue="请选择"></s:select>
					
					
				
			</table>
		</td>

		<td>
			<table class="form_table">
				<s:textfield label="政治面貌" name="employee.politicalStatus" size="18"
					maxlength="20"></s:textfield>
				<s:textfield label="E-mail" name="employee.email" size="18"
					maxlength="50"></s:textfield>
				<s:textfield label="手机号码" name="employee.phoneNumber" size="18"
					id="phoneNumber" />
				<s:textfield label="家庭电话" name="employee.homePhoneNumber" size="18"
					 maxlength="50"></s:textfield>
				<s:textfield label="身份证上住址" name="employee.address" size="18"
					maxlength="50"></s:textfield>
				<s:textfield label="现住址" name="employee.currentlyAddress" size="18"
					maxlength="50"></s:textfield>
				<s:textfield label="试用期薪资" name="employee.internSalary" size="18"
					maxlength="20"></s:textfield>
				<s:textfield label="转正薪资" name="employee.contractSalary" size="18"
					maxlength="20"></s:textfield>
				<s:textfield label="绩效工资" name="employee.performanceSalary" size="18"
					maxlength="20"></s:textfield>	
				<s:select label="婚姻状况" list="marriagementState" 
					name="employee.marriagementState.dictionaryId" listKey="dictionaryId"
					listValue="dictionaryName" >
				</s:select>
				<s:textfield label="毕业院校" name="employee.graduatedSchool" size="18"
					maxlength="20"></s:textfield>
				<s:textfield label="专业" name="employee.graduatedMajor" size="18"
					maxlength="20"></s:textfield>
				<s:select label="学历" list="degrees" 
					name="employee.degree.dictionaryId" listKey="dictionaryId"
					listValue="dictionaryName" >
				</s:select>
				<!-- TODO -->
				<s:select label="是否统招" id="unified_entrance" name="employee.unifiedEntrance.dictionaryId"
					list="unifiedEntrance"  listKey="dictionaryId" listValue="dictionaryName" ></s:select>
				<s:textfield label="毕业时间" name="employee.graduatedTime" id="employee_graduatedTime" size="18"
					maxlength="20"></s:textfield>	
				<s:textfield label="登录帐户" required="true" name="employee.userInfo.loginId" size="18"
					maxlength="20"></s:textfield>
				
				
				
				<!-- Remove at 2011/12/11	
				<s:textfield label="邮编" name="employee.postcode" size="18"
					 maxlength="6"></s:textfield>
				<s:textfield label="在岗时间" name="employee.positionLength" size="18"
					maxlength="20"></s:textfield>
				<s:select label="薪资" list="salary" 
					name="employee.salary.dictionaryId" listKey="dictionaryId"
					listValue="dictionaryName" ></s:select>
				<s:textfield label="薪资数目" name="employee.salaryAmount" size="18"
					maxlength="20"></s:textfield>
				<s:select label="培训状态" list="trainingState" 
					name="employee.trainingState.dictionaryId" listKey="dictionaryId"
					listValue="dictionaryName" ></s:select>
				-->
			</table>
		</td>

		<td>
			<table class="form_table">
				<s:select label="户口类别" list="registeredResidenceType" 
					name="employee.registeredResidenceType.dictionaryId" listKey="dictionaryId"
					listValue="dictionaryName" ></s:select> 
				<s:select label="社保状态" list="socialStatus" 
					name="employee.socialStatus.dictionaryId"
					listKey="dictionaryId" listValue="dictionaryName"
					></s:select>
				<s:select label="社保办理状态" list="socialSecurityStatus" 
					name="employee.socialSecurityStatus.dictionaryId"
					listKey="dictionaryId" listValue="dictionaryName"
					></s:select>
				<s:textfield label="申报工资" name="employee.announcedSalary" size="18"
					 maxlength="20"></s:textfield>
				<s:textfield label="社保办理日期" name="employee.socialSecurityTime"  id="employee_socialSecurityTime" size="18"
					maxlength="20"></s:textfield>	
				<s:select label="社保单位" list="socialSecurityCompany" 
					name="employee.socialSecurityCompany.dictionaryId"
					listKey="dictionaryId" listValue="dictionaryName"></s:select>
				<s:select label="社保人员类型" list="socialSecurityType" 
					name="employee.socialSecurityType.dictionaryId"
					listKey="dictionaryId" listValue="dictionaryName"></s:select>	
				<s:select label="参保种类" list="socialSecuritySort" 
					name="employee.socialSecuritySort.dictionaryId"
					listKey="dictionaryId" listValue="dictionaryName"></s:select>
				<s:select label="社保卡领取状态" list="socialSecurityCardStatus" 
					name="employee.socialSecurityCardStatus.dictionaryId"
					listKey="dictionaryId" listValue="dictionaryName"></s:select>
				<s:select label="医保卡领取状态" list="healthSecurityCardStatus" 
					name="employee.healthSecurityCardStatus.dictionaryId"
					listKey="dictionaryId" listValue="dictionaryName"></s:select>
				<s:textfield label="招聘渠道" name="employee.onBoardWay" size="18"
					maxlength="20"></s:textfield>	
				<s:textfield label="离职时间" name="employee.timeOfLeaving"  id="employee_timeOfLeaving" size="18"
					 maxlength="50"></s:textfield>	
				<!-- TODO -->
				<s:select label="离职是否办理手续" id="quit_job_papers" name="employee.quitJobPapers.dictionaryId"
					list="quitJobPapers"   listKey="dictionaryId" listValue="dictionaryName" ></s:select>
				<s:textfield label="紧急联系人" name="employee.contactInBJ" size="18"
					maxlength="20"></s:textfield>
				<s:textfield label="紧急联系人电话" name="employee.phoneOfContactInBJ" size="18"
					maxlength="50"></s:textfield>		
				<s:textfield label="登陆密码" required="true" name="employee.userInfo.loginPwd" size="18"
					maxlength="20"></s:textfield>	
				<s:hidden name="employee.userInfo.userId"></s:hidden>	
				
				<!-- Remove at 2011/12/11		
				<s:textfield label="紧急联系人住址" name="employee.addressInBJ" size="18"
					maxlength="200"></s:textfield>
				<s:textfield label="家庭成员" name="employee.familyMember" size="18"
					maxlength="20"></s:textfield>
				<s:textfield label="家庭成员电话" name="employee.familyMemberPhone" size="18"
					maxlength="20"></s:textfield>
				<s:textfield label="家庭成员地址" name="employee.familyMemberAddress" size="18"
					maxlength="50"></s:textfield>
				-->
			</table>
		</td>
	</tr>
	
	<tr>
		<td colspan="15">
		<br>
			<fieldset style="width: 98%">
		<legend>
			工资卡:
		</legend>
			<table id="bankCard_table" width="100%">
				<thead>
					<tr>
						<td>
							开卡银行
						</td>
						<td>
							帐号
						</td>
						<td>
							<a href="javascript:void(0)" id="bankCard_add_button">添加</a>
						</td>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="employee.bankCards" status="st">						
						<tr>
							<td>
								<s:textfield  value="%{bankName}"  cssClass="bankName" name="bankName" theme="simple"/>
							</td>
							<td>
								<s:textfield   value="%{bankAccount}"  cssClass="bankAccount" name="bankAccount" theme="simple"/>
							</td>
							<td>
								<a href="javascript:void(0)" onclick="deleteRecord(this)">删除</a>
							</td>
						</tr>
					</s:iterator>
				</tbody>
			</table>
			</fieldset>
		</td>
	</tr>
	<tr>
		<td colspan="15">
		<br>
			<fieldset style="width: 98%">
		<legend>
			劳动合同:
		</legend>
			<table id="contract_table" width="100%">
				<thead>
					<tr>
						<td>
							劳动合同第次
						</td>
						<td>
							开始时间
						</td>
						<td>
							结束时间
						</td>
						<td>
							岗位聘任书
						</td>
						<td>
							<a href="javascript:void(0)" id="contract_add_button">添加</a>
						</td>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="employee.contracts" status="st">						
						<tr>
							<td>
								第<s:textfield size="1"  value="%{th}"  cssClass="th" name="th" theme="simple"/>次
							</td>
							<td>
								<s:textfield  value="%{startTime}" cssClass="startTime" name="startTime" theme="simple"/>
							</td>
							<td>
								<s:textfield   value="%{endTime}" cssClass="endTime"  name="endTime"  theme="simple"/>
							</td>
							<td>
								<s:textfield   value="%{engageContract}" cssClass="engageContract"  name="engageContract"  theme="simple"/>
							</td>
							<td>
								<a href="javascript:void(0)" onclick="deleteRecord(this)">删除</a>
							</td>
						</tr>
					</s:iterator>
				</tbody>
			</table>
			</fieldset>
		</td>

	</tr>

	<tr>
		<td colspan="15">
		<br>
			<fieldset style="width: 98%">
		<legend>
			工作简历:
		</legend>
			<table id="exprience_table" width="100%">
				<thead>
					<tr>
						<td>
							所在单位
						</td>
						<td>
							入职时间
						</td>
						<td>
							离职时间
						</td>
						<td>
							部门
						</td>
						<td>
							职位
						</td>
						<td>
							工资
						</td>
						<td>
							离职原因
						</td>
						<td>
							证明人
						</td>
						<td>
							电话
						</td>
						<td>
							<a href="javascript:void(0)" id="exprience_add_button">添加</a>
						</td>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="employee.experiences" status="st">						
						<tr>
							<td>
								<s:textfield   value="%{companyName}"  cssClass="companyName" name="companyName" theme="simple"/>
							</td>
							<td>
								<s:textfield  value="%{startTime}" cssClass="startTime" name="startTime" theme="simple"/>
							</td>
							<td>
								<s:textfield    value="%{endTime}" cssClass="endTime" name="endTime" theme="simple"/>
							</td>
							<td>
								<s:textfield   value="%{department}"  cssClass="department" name="department" theme="simple"/>
							</td>
							<td>
								<s:textfield  value="%{position}" cssClass="position" name="position" theme="simple"/>
							</td>
							<td>
							
								<s:textfield    value="%{salary}" cssClass="salary" name="salary" theme="simple"/>
							</td>
							<td>
								<s:textfield size="1"  value="%{cause}"  cssClass="cause" name="cause" theme="simple"/>
							</td>
							<td>
								<s:textfield  value="%{contract}" cssClass="contract" name="contract" theme="simple"/>
							</td>
							<td>
							
								<s:textfield    value="%{phoneNumber}" cssClass="phoneNumber" name="phoneNumber"  theme="simple"/>
							</td>
							<td>
								<a href="javascript:void(0)" onclick="deleteRecord(this)">删除</a>
							</td>
						</tr>
					</s:iterator>
				</tbody>
			</table>
			</fieldset>
		</td>
	</tr>
	
	<tr>
		<td colspan="15">
		<br>
			<fieldset style="width: 98%">
		<legend>
			资格证书:
		</legend>
			<table id="credential_table" width="100%">
				<thead>
					<tr>
						<td>
							证书名称
						</td>
						<td>
							取得时间
						</td>
						<td>
							培训机构
						</td>
						<td>
							内容
						</td>
						<td>
							<a href="javascript:void(0)" id="credential_add_button">添加</a>
						</td>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="employee.credentials" status="st">						
						<tr>
							<td>
								<s:textfield  value="%{name}"  cssClass="name" name="name" theme="simple"/>
							</td>
							<td>
								<s:textfield   value="%{awardTime}"  cssClass="awardTime" name="awardTime" theme="simple"/>
							</td>
							<td>
								<s:textfield  value="%{institution}" cssClass="institution" name="institution" theme="simple"/>
							</td>
							<td>
							
								<s:textfield  cssClass="comments"  value="%{comments}" name="comments" theme="simple"/>
							</td>
							<td>
								<a href="javascript:void(0)" onclick="deleteRecord(this)">删除</a>
							</td>
						</tr>
					</s:iterator>
				</tbody>
			</table>
			</fieldset>
		</td>
	</tr>
	
	<tr>
		<td colspan="15">
			<table class="form_table">
				<s:textarea label="惩罚记录" name="employee.punishmentRecord" cssStyle="width:600px"></s:textarea>
			</table>
		</td>
	</tr>
	<tr>
		<td colspan="15">
			<table class="form_table">
				<s:textarea label="员工备注" name="employee.remarks" cssStyle="width:600px"></s:textarea>
			</table>
		</td>
	</tr>

</s:form>



<script type="text/javascript">
<!--

  $(document).ready(function(){
  
    $('form').submit(function(){
    	var setInputName=function(i,o){
    		var index=$(this).parent().parent()[0].rowIndex-1;
    		$(this).attr('name',prefix+'['+index+'].'+$(this).attr('name'));
    	}   	
    	var prefix='employee.contracts';
    	
    	
    	$('input','#contract_table').each(setInputName);
    	
    	prefix='employee.experiences';
    	$('input','#exprience_table').each(setInputName);
    	
    	prefix='employee.credentials';
    	$('input','#credential_table').each(setInputName);
    	
    	prefix='employee.bankCards';
    	$('input','#bankCard_table').each(setInputName);
    	return true;
    })
    
    $('#employee_socialId').parent().append('<a href="javascript:void(0)" onclick="checkID()">分析</a>');
     
    $('#contract_add_button').click(function(){
    	var buffer=new StringBuffer();
		buffer.append('<tr>');
		buffer.append('<td>');
		buffer.append('第<input size="1" class="th" name="th"/>次');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<input  class="startTime" name="startTime"/>');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<input  class="endTime" name="endTime"/>');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<input  class="engageContract" name="engageContract"/>');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<a href="javascript:void(0)" onclick="deleteRecord(this)">删除</a>');
		buffer.append('</td>');
		buffer.append('</tr>');
		$('#contract_table>tbody').append(buffer.toString());
    	return false;
    })
     $('#exprience_add_button').click(function(){
    	var buffer=new StringBuffer();
		buffer.append('<tr>');
		
		buffer.append('<td>');
		buffer.append('<input  class="companyName" name="companyName"/>');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<input  class="startTime" size="10" name="startTime"/>');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<input  class="endTime" size="10" name="endTime"/>');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<input  class="department" name="department"/>');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<input  class="position" size="6" name="position"/>');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<input  class="salary" size="6" name="salary"/>');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<input  class="cause" name="cause"/>');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<input  class="contract" size="6" name="contract"/>');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<input  class="phoneNumber" name="phoneNumber"/>');
		buffer.append('</td>');

		
		buffer.append('<td>');
		buffer.append('<a href="javascript:void(0)" onclick="deleteRecord(this)">删除</a>');
		buffer.append('</td>');
		buffer.append('</tr>');
		$('#exprience_table>tbody').append(buffer.toString());
    	return false;
    })
    $('#credential_add_button').click(function(){
    	var buffer=new StringBuffer();
		buffer.append('<tr>');
		
		buffer.append('<td>');
		buffer.append('<input  class="name" name="name"/>');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<input  class="awardTime" name="awardTime"/>');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<input  class="institution" name="institution"/>');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<input  class="comments" name="comments"/>');
		buffer.append('</td>');

		
		buffer.append('<td>');
		buffer.append('<a href="javascript:void(0)" onclick="deleteRecord(this)">删除</a>');
		buffer.append('</td>');
		buffer.append('</tr>');
		$('#credential_table>tbody').append(buffer.toString());
    	return false;
    })
     $('#bankCard_add_button').click(function(){
    	var buffer=new StringBuffer();
		buffer.append('<tr>');
		
		buffer.append('<td>');
		buffer.append('<input  class="bankName" name="bankName"/>');
		buffer.append('</td>');
		buffer.append('<td>');
		buffer.append('<input  class="bankAccount" name="bankAccount"/>');
		buffer.append('</td>');
		
		buffer.append('<td>');
		buffer.append('<a href="javascript:void(0)" onclick="deleteRecord(this)">删除</a>');
		buffer.append('</td>');
		buffer.append('</tr>');
		$('#bankCard_table>tbody').append(buffer.toString());
    	return false;
    })
  	$('#employee_position_positionId').changeSelect($('#employee_department').val());
  	$('#employee_timeOfEmployment').datepicker({
  			dateFormat:'yy-m-d',
  			yearRange: '1900:2100', 
			changeMonth: true,
			changeYear: true
		});
  	$('#employee_registerTime').datepicker({
  			dateFormat:'yy-m-d',
  			yearRange: '1900:2100', 
  			changeMonth: true,
			changeYear: true
		});
  	$('#employee_timeOfLeaving').datepicker({
  			dateFormat:'yy-m-d',
  			yearRange: '1900:2100', 
  			changeMonth: true,
			changeYear: true
		});
  	$('#employee_birthday').datepicker({
  			dateFormat:'yy-m-d',
  			yearRange: '1900:2100', 
  			changeMonth: true,
			changeYear: true
		});
	$('#employee_graduatedTime').datepicker({
  			dateFormat:'yy-m-d',
  			yearRange: '1900:2100', 
  			changeMonth: true,
			changeYear: true
		});
  	$('#employee_socialSecurityTime').datepicker({
  			dateFormat:'yy-m-d',
  			yearRange: '1900:2100', 
  			changeMonth: true,
			changeYear: true
		});
	$('#employee_firstContractTime').datepicker({
  			dateFormat:'yy-m-d',
  			yearRange: '1900:2100', 
  			changeMonth: true,
			changeYear: true
		});
	$('#employee_firstContractEndTime').datepicker({
  			dateFormat:'yy-m-d',
  			yearRange: '1900:2100', 
  			changeMonth: true,
			changeYear: true
		});
	$('#employee_secondContractTime').datepicker({
  			dateFormat:'yy-m-d',
  			yearRange: '1900:2100', 
  			changeMonth: true,
			changeYear: true
		});
	$('#employee_secondContractEndTime').datepicker({
  			dateFormat:'yy-m-d',
  			yearRange: '1900:2100', 
  			changeMonth: true,
			changeYear: true
		});
	$('#employee_thirdContractTime').datepicker({
  			dateFormat:'yy-m-d',
  			yearRange: '1900:2100', 
  			changeMonth: true,
			changeYear: true
		});
	$('#employee_thirdContractEndTime').datepicker({
  			dateFormat:'yy-m-d',
  			yearRange: '1900:2100', 
  			changeMonth: true,
			changeYear: true
		});
  	
    $("form").validate({
    	errorLabelContainer: $("div.error"),
    	focusInvalid: true,
    	rules: {           //定义验证规则,其中属性名为表单的name属性  
        	'employee.employeeName': {  
        		required: true,  
               	rangelength: [2, 20]
              	},
        
			'employee.userInfo.loginPwd': {  
                required: true,  
                rangelength: [4,16],
                isPassword: true
            },
            'employee.timeOfEmployment': {
            	required: true
            }
            ,
            'employee.position.positionId': {
            	required: true
            },
            'employee.postcode': {
            	number: true,
            	rangelength: [6,10]	
            },
            'employee.phoneNumber': {
            	rangelength: [6,30]	
            },
            'employee.homePhoneNumber': {
            	rangelength: [6,30]	
            }
            ,
            'employee.socialId': {
            	rangelength: [15,18],
            	isID: true
            }
         }, 
         messages: {       //自定义验证消息  
         	'employee.employeeName': {  
            	required: "姓名是必需的<br>",  
                rangelength: $.format("姓名至少要{0}个字符<br>"),  
                remote: $.format("{0}已经被占用<br>")              
         	},
         	'employee.userInfo.loginPwd': {  
                required: "登陆密码是必需的<br>",  
				rangelength: $.format("登陆密码要在{0}-{1}个字符之间<br>"),
				isPassword: "登陆密码只能是字母或数字<br>"
             },  
            'employee.timeOfEmployment': {  
                 required: "入职时间是必需的<br>"
             },
            'employee.position.positionId': {  
            	required: "职务是必需的<br>"             
         	},
         	'employee.postcode': {  
            	number: "邮编应为数字<br>",
            	rangelength: $.format("邮编应为{0}-{1}个字符<br>") 
         	},
         	'employee.phoneNumber': {   
				rangelength: $.format("手机号码要在{0}-{1}个字符之间<br>")
             },  
            'employee.homePhoneNumber': {  
                rangelength: $.format("家庭电话要在{0}-{1}个字符之间<br>")
             },
            'employee.socialId': {
            	rangelength: $.format("身份证号应为{0}或{1}个字符<br>"),
            	isID: $.format("无效的身份证号码<br>")
            }
         }
    });
  });
 jQuery.fn.extend({
  changeSelect: function(id) {
  	if(!id)return;
		$.ajax({
		          type: "POST",// 用POST方式传输
		          dataType:"json",// 数据格式:html
		          data:'parent='+id,
		          url:'dictionary/children',// 目标地址
		     	  success:function(json) {
		     	  		$('#employee_position_positionId').empty(); 
						$.each(json,function(index,obj){
			  				var option = document.createElement("option");;   
			     			option.text = obj.dictionaryName;   
			     			option.value = obj.dictionaryId;   
			     			 if(option.value=='<s:property value="employee.position.dictionaryId"/>'){
			     				option.selected ="selected";
			     			}
			     			$("#employee_position_positionId")[0].options.add(option); 
					  	});
				   }
		    	});	
    }
  

});


function deleteRecord(a){
	var tr=$(a).parent().parent();
	$(tr).remove();
}

function checkID(){
	var id = $('#employee_socialId').val();
	if(IdCardValidate(id)){
		if(maleOrFemalByIdCard(id)==("male")){
			$('#sex').val(101);
		}else{
			$('#sex').val(102);
		}
		
		var result = getIdInformation();
		var birthday = result[0]+"-"+result[1]+"-"+result[2];
		$('#employee_birthday').val(birthday);
		
		var today = new Date();
		var age = today.getFullYear() - result[0];
		$('#age').val(age);
	}
}

//-->
</script>